<div class="ui-grid-row">
    <div class="button-item">
        <button pButton type="text" class="ui-button-warning" icon="fa fa-search" label="重置" (click)="reset()"></button>
        <button pButton type="text" class="ui-button-info" icon="fa fa-plus" label="保存" (click)="save()"></button>
    </div>
</div>
<div class="ui-widget-content fb-baseinfo-content fb-baseinfo-datapush-content" style="height:100%;margin-top:-5px;">
    <!--数据源维护表单-->
    <div class="ui-g datapush-form">
        <form [formGroup]="datapushForm" style="width:100%">
            <input type="hidden" formControlName="dataPushId">
            <div class="ui-g-12">
                <div class="ui-g-1">名称
                    <span style="color:red;">*</span>
                </div>
                <div class="ui-g-3">
                    <input pInputText type="text" formControlName="dataPushName" style="width:100%" pTooltip="{{ formErrors.dataPushName }}"/>
                </div>
                <div class="ui-g-1">系统源
                    <span style="color:red;">*</span>
                </div>
                <div class="ui-g-2">
                    <p-dropdown formControlName="systemId" [options]="systemInfos" [style]="{'width':'100%'}"  
                        placeholder="数据源系统"></p-dropdown>
                </div>
                <div class="ui-g-1">抽取方式
                    <span style="color:red;">*</span>
                </div>
                <div class="ui-g-2">
                    <p-dropdown formControlName="expressionType" [options]="expressionTypes" [style]="{'width':'100%'}"
                        placeholder="数据源系统"></p-dropdown>
                </div>
            </div>
            <div class="ui-g-12" style="padding-top:0px">
                <div class="ui-g-1">表达式
                    <span style="color:red;">*</span>
                </div>
                <div class="ui-g-9">
                    <textarea pInputTextarea rows="4" formControlName="dataExpression" style="width:100%"></textarea>
                </div>
            </div>
        </form>
    </div>
    <!--已保存数据源列表-->
    <div class="ui-g datapush-listtable-container">
        <p-table [columns]="cols" [value]="datapushs" 
            selectionMode="single" [(selection)]="selectedDataPush" 
            (onRowSelect)="onRowSelect($event)"
            [scrollable]="true" [scrollHeight]="datapushScrollHeight">
            <ng-template pTemplate="header" let-columns>
                <tr>
                    <th *ngFor="let col of columns" [ngStyle]="col.style">
                        {{col.header}}
                    </th>
                    <th style="width: 8em;"></th>
                </tr>
            </ng-template>
            <ng-template pTemplate="body" let-rowData let-columns="columns">
                <tr [pSelectableRow]="rowData">
                    <td *ngFor="let col of columns" [ngStyle]="col.style">
                        {{rowData[col.field]}}
                    </td>
                    <td style="width: 8em;text-align: center;">
                        <i class="fa fa-search" (click)="validate(rowData)"></i> 
                        &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;
                        <i class="fa fa-trash ui-button-danger" (click)="delete(rowData)"></i> 
                    </td>
                </tr>
            </ng-template>
        </p-table>
    </div>
</div>